function Birthday()
{
    var month = (prompt("Vilken månad fyller du år (1-12)?") - 1);
    var day = prompt("Vilen dag fyller du år (1-31)?");
    
    var dateOfBirth = new Date();
    dateOfBirth.setMonth(month, day);
    
    var todaysDate = new Date();
    
    var millisecondsToBirthday = dateOfBirth - todaysDate;
    
    // If differenceInMilliseconds is a positive value just convert it to days.
    if (millisecondsToBirthday > 0)
    {
        
    }
    // else differenceInMilliseconds is negative, this means your birthday has already
    // passed this year and we have to add 1 year to dateOfBirth and then count the
    // milliseconds again.
    else
    {
        dateOfBirth.setYear(dateOfBirth.getFullYear() + 1);
        millisecondsToBirthday = dateOfBirth - todaysDate;
    }
    
    var daysToBirthday = MillisecondsToDays(millisecondsToBirthday);
    
    // Present the result in HTML.
    var resultString = "Days until your birthday: " + daysToBirthday;
    
    document.getElementById("days").innerHTML=resultString;
}

function MillisecondsToDays(a_milliseconds)
{
    var days = 0;
    
    // Parse as int since we only care about whole days.
    days = parseInt(a_milliseconds/86400000);
    
    return days;
}